#include "mainwidget.h"
#include "ui_mainwidget.h"



mainWidget::mainWidget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::mainWidget)
{
    ui->setupUi(this);

    this->setWindowTitle("437k小游戏");
    //初始化函数
    Init();
    //透明按钮
    ui->pushButton->setFlat(true);
    ui->pushButton_2->setFlat(true);
    ui->pushButton_3->setFlat(true);
    ui->pushButton_4->setFlat(true);
    ui->pushButton_5->setFlat(true);
    ui->pushButton_6->setFlat(true);
}

mainWidget::~mainWidget()
{
    delete m_mata;   m_mata = NULL;
    //delete m_w;  m_w =NULL;
    delete m_g; m_g = NULL;
    delete m_sm; m_sm=NULL;
    delete m_m; m_m=NULL;
    delete ui;
}


void mainWidget::on_pushButton_2_clicked()
{
    m_mata->show();
}

void mainWidget::Init()
{
    //指针初始化为 NULL
    m_mata = NULL;
    //m_w= NULL;
    m_g =NULL;
    m_sm=NULL;
    m_m=NULL;
    //新建子窗口
    m_mata = new mata(NULL);
    //m_w =new Widget(NULL);
    m_g =new GameBoard(NULL);
    m_sm= new shuoming(NULL);
    m_m=new music(NULL);
    //设置子窗口标题栏
    m_mata->setWindowTitle(tr("马踏棋盘"));
    //m_w.setWindowTitle(tr("俄罗斯方块"));
    m_g->setWindowTitle(tr("2048"));
    m_g->setWindowIcon(QIcon(":/Image/2048.ico"));
    m_sm->setWindowTitle(tr("437k各游戏说明"));
    m_m->setWindowTitle("背景音乐选择");
}

void mainWidget::on_pushButton_3_clicked()
{
     Widget *m_w= new Widget(NULL);
    m_w->show();
}

void mainWidget::on_pushButton_4_clicked()
{
    m_g->show();
}

void mainWidget::on_pushButton_5_clicked()
{
    m_sm->show();
}

void mainWidget::on_pushButton_clicked()
{
    m_M.show();
}

void mainWidget::on_pushButton_6_clicked()
{
    m_m->show();
}
